﻿Imports System.Data.OleDb
Imports DTO

Public Class QuiDinhDAO
    Inherits Connect

    Public Sub CapNhat(ByVal dto As quidinhdto)
        Dim cn As New OleDbConnection
        cn = Me.ConnectionData()
        Dim sql As String
        sql = "Update THAMSO set SoTietToiDaTrongNgay=" & dto.Sotiettoidatrongngay & ", TietGay=" & _
        dto.Tietgay & ", SoTietToiDaDuocHocTrongNgay=" & dto.Sotiettoidaduochoctrongngay
        Dim cmd As New OleDbCommand(sql, cn)
        cmd.ExecuteNonQuery()
        cn.Close()
    End Sub

    Public Function TietToiDaTrongNgay() As Integer
        Dim cn As New OleDbConnection
        cn = Me.ConnectionData()
        Dim n As Integer
        Dim sql = "Select SoTietToiDaTrongNgay from ThamSo"
        Dim cmd As New OleDbCommand(sql, cn)
        n = cmd.ExecuteScalar()
        cn.Close()
        Return n
    End Function

    Public Function TietToiDaDuocHoc() As Integer
        Dim cn As New OleDbConnection
        cn = Me.ConnectionData()
        Dim n As Integer
        Dim sql = "Select SoTietToiDaDuocHocTrongNgay from ThamSo"
        Dim cmd As New OleDbCommand(sql, cn)
        n = cmd.ExecuteScalar()
        cn.Close()
        Return n
    End Function

    Public Function TietGay() As Integer
        Dim cn As New OleDbConnection
        cn = Me.ConnectionData()
        Dim n As Integer
        Dim sql = "Select TietGay from ThamSo"
        Dim cmd As New OleDbCommand(sql, cn)
        n = cmd.ExecuteScalar()
        cn.Close()
        Return n
    End Function
End Class
